import PlanAPI from "../../../repo/api/PlanAPI";
import store from "../../../repo/store/store";

let MyCertiMixin = {
  data() {
    return {
      name: '我的证书',
      certificationList: [],
    }
  },
  computed: {
    myCertiList() {
      return this.certificationList || []
    },
  },
  created(){
    this.fetchMyCertificates();
  },
  methods: {
    fetchMyCertificates() {
      let userId = store.getters.userid;
      return PlanAPI.getMyUserCertificationList(userId).then((result) => {
        this.certificationList = result.responseData.list
        return result
      })
    },
    onItemClick(certification) {
      let certId = certification.id;
      let userId = this.$store.getters.userid
      this.$router.push(`/cert/${certId}/${userId}`)
    },
  },

}

export default MyCertiMixin

